<?php
/*##################################################
# 模块功能：保存功能配置
###################################################*/
 require_once('class.db.php');
 session_start(); 
 if(isset($_SESSION['lock_config'])){ $time=(int)$_SESSION['lock_config']-(int)time(); if($time>0){ exit(json_encode(array('success'=>0,'icon'=>5,'msg'=>"请勿频繁提交，".$time."秒后再试！")));}}
 $_SESSION['lock_config']= time()+ $from_timeout;

 $lywq['pupop']['status'] = filter_input(INPUT_POST, "lywq_pupop_status");
 $lywq['pupop']['terminal'] = implode("|", $_POST['lywq_pupop_terminal']);
 $lywq['pupop']['interval']['type'] = filter_input(INPUT_POST, "lywq_pupop_interval_type");
 $lywq['pupop']['interval']['time'] = filter_input(INPUT_POST, "lywq_pupop_interval_time");
 $lywq['pupop']['interval']['number'] = filter_input(INPUT_POST, "lywq_pupop_interval_number");
 $lywq['pupop']['title'] = filter_input(INPUT_POST, "lywq_pupop_title");
 $lywq['pupop']['type'] = filter_input(INPUT_POST, "lywq_pupop_type");
 $lywq['pupop']['content']['image'] = filter_input(INPUT_POST, "lywq_pupop_content_image");
 $lywq['pupop']['content']['text'] = filter_input(INPUT_POST, "lywq_pupop_content_text");
 $lywq['pupop']['leftbutton']['name'] = filter_input(INPUT_POST, "lywq_pupop_leftbutton_name");
 $lywq['pupop']['leftbutton']['url'] = filter_input(INPUT_POST, "lywq_pupop_leftbutton_url");
 $lywq['pupop']['rightbutton']['name'] = filter_input(INPUT_POST, "lywq_pupop_rightbutton_name");
 $lywq['pupop']['rightbutton']['url'] = filter_input(INPUT_POST, "lywq_pupop_rightbutton_url");
 

 $lywq['Hpupop']['title'] = filter_input(INPUT_POST, "lywq_Hpupop_title");
 $lywq['Hpupop']['type'] = filter_input(INPUT_POST, "lywq_Hpupop_type");
 $lywq['Hpupop']['content']['image'] = filter_input(INPUT_POST, "lywq_Hpupop_content_image");
 $lywq['Hpupop']['content']['text'] = filter_input(INPUT_POST, "lywq_Hpupop_content_text");
 $lywq['Hpupop']['leftbutton']['name'] = filter_input(INPUT_POST, "lywq_Hpupop_leftbutton_name");
 $lywq['Hpupop']['leftbutton']['url'] = filter_input(INPUT_POST, "lywq_Hpupop_leftbutton_url");
 $lywq['Hpupop']['rightbutton']['name'] = filter_input(INPUT_POST, "lywq_Hpupop_rightbutton_name");
 $lywq['Hpupop']['rightbutton']['url'] = filter_input(INPUT_POST, "lywq_Hpupop_rightbutton_url");
 
 
 $lywq['pupop']['snow']['status'] = filter_input(INPUT_POST, "lywq_pupop_snow_status");
 $lywq['pupop']['snow']['type'] = filter_input(INPUT_POST, "lywq_pupop_snow_type");
 $lywq['pupop']['snow']['image'] = filter_input(INPUT_POST, "lywq_pupop_snow_image");

if( Main_db::save()){
	exit(json_encode(array('success'=>1,'icon'=>1,'msg'=>"保存成功!")));
}else{
	exit(json_encode(array('success'=>0,'icon'=>0,'msg'=>"保存失败!请检测配置文件权限")));
} 

?>